package main

import (
	"fmt"
	"math"
)

func sqrt(x float64) float64 {
	z := 1.0
	for i := 0; i < 10 && math.Abs(z*z-x) > 1e-6; i++ {
		z -= (z*z - x) / (2 * z)
		// fmt.Println(i, z)
	}
	return z
}

func main() {
	fmt.Println(sqrt(2))
	fmt.Println(math.Sqrt(2))
}
